#ifndef     __PROG_H
#define     __PROG_H

#include "../rtos/rtos.h"
#include "./no_copyable.h"

namespace utils {

struct prog_t : private no_copyable_t {

public:
    inline prog_t() : m_begin( osKernelGetTickCount() ) {}

    inline uint32_t duration() const {
        return osKernelGetTickCount() - m_begin;
    }

    inline bool is_after(uint32_t duration) const {
        return osKernelGetTickCount() >= (m_begin + duration);
    }
    
    inline void reset() {
        m_begin = osKernelGetTickCount();
    }

private:
    uint32_t m_begin;
};

}

#endif
